﻿using System.Web.Mvc;
using System.Collections.Generic;
using System.Linq;

namespace QianBuo.Lottery.Web.Areas.Manage
{
    public class ManageAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "Manage";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            var setts = System.Configuration.ConfigurationManager.AppSettings;
            string path=null;
            path = setts["ManagePath"];
            if (string.IsNullOrEmpty(path))
                path = "abc";

            string ext=null;
            ext = setts["UrlExt"];
            if (string.IsNullOrEmpty(ext))
                ext = "";
            else if (!ext.StartsWith("."))
                ext = "." + ext;
            
            context.MapRoute(
                "Manage_default.html1",
                path+"/{controller}"+ext,
                new { controller = "Home", action = "Index"},
                new string[] { "QianBuo.Lottery.Web.Areas.Manage.Controllers" }
            );

            context.MapRoute(
                "Manage_default.html3",
                path + "/{controller}/{action}/{id}" + ext,
                new { controller = "Home", action = "Index"},
                new string[] { "QianBuo.Lottery.Web.Areas.Manage.Controllers" }
            );
            
            context.MapRoute(
                "Manage_default.html2",
                path + "/{controller}/{action}" + ext,
                new { controller = "Home", action = "Index"},
                new string[] { "QianBuo.Lottery.Web.Areas.Manage.Controllers" }
            );
            
            context.MapRoute(
                "Manage_default",
                path+"/{controller}/{action}/{id}",
                new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                new string[] { "QianBuo.Lottery.Web.Areas.Manage.Controllers" }
            );
        }
    }
}
